Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Label] Add get_character_bounds method to get bounding rectangles of the characters. #84185

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Oct 30, 2023

Closes godotengine/godot-proposals#8299

Adds Label.get_character_bounds(character pos) method, which return bounding rectangle of the character. If the character is a non-visual character or pos is invalid, empty Rect2 is returned. If the character is a part of a composite grapheme, the bounding rectangle of the whole grapheme is returned.

Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great.

@YuriSizov YuriSizov modified the milestones: 4.x, 4.3 Nov 6, 2023
Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small details, LGTM otherwise

doc/classes/Label.xml Outdated Show resolved Hide resolved
@peachpieproductions
Copy link

Will this be added to RichTextLabel?

@YuriSizov
Copy link
Contributor

@bruvzg Would you mind updating the docs as suggested?

@YuriSizov YuriSizov merged commit 179b8c7 into godotengine:master Dec 19, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@IntangibleMatter
Copy link
Contributor

Any chance something like this will be added for RichTextLabel? I get that it'd be a bit more complicated, but it would be incredibly useful for many things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Label method to get position of a character
6 participants